#ifndef _STATE_H
#define _STATE_H

#include <vector>

class Edge;

class State
{
public:
	State();
	State(unsigned int dim, double* q) { set_q(dim, q); }
	~State();

	unsigned int get_dim() { return dim; }
	double* get_q() { return q; }

	void set_q(unsigned int dim, double* q) 
	{
		if (q == NULL)
			throw new std::exception();
		
		this->dim = dim; 
		this->q = new double[dim]; 
		for (unsigned int i = 0; i < dim; ++i)
			this->q[i] = q[i];
	}
	void set_q(State* state) { set_q(state->dim, state->get_q()); }

	void add_child(State* state, double cost_step, unsigned int dim_ctrl, double* ctrl);
	void add_parent(State* state, double cost_step, unsigned int dim_ctrl, double* ctrl);

	double* get_parent_q();

	double get_cost(){ return cost; }
	void set_cost(double value){ cost = value; }

protected:
	unsigned int dim;
	double* q;
	double cost;

	std::vector<Edge*>* children;
	std::vector<Edge*>* parents;
};

#endif